package com.lechi.web.controller;

import com.lechi.web.common.annotation.Log;
import com.lechi.web.common.core.controller.BaseController;
import com.lechi.web.common.core.domain.AjaxResult;
import com.lechi.web.common.core.page.TableDataInfo;
import com.lechi.web.common.enums.BusinessType;
import com.lechi.web.system.domain.IotOperLog;
import com.lechi.web.system.service.IIotOperLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 操作日志记录Controller
 *
 * @author yangguang
 * @date 2024 -05-17
 */
@RestController
@RequestMapping("/iot/log")
@RequiredArgsConstructor
public class IotOperLogController extends BaseController {

    private final IIotOperLogService iotOperLogService;

    /**
     * 查询操作日志记录列表
     *
     * @param iotOperLog the iot oper log
     * @return the table data info
     */
    @GetMapping("/list")
    public TableDataInfo list(IotOperLog iotOperLog) {
        startPage();
        List<IotOperLog> list = iotOperLogService.selectIotOperLogList(iotOperLog);
        return getDataTable(list);
    }


    /**
     * 删除操作日志记录
     *
     * @param ids the ids
     * @return the ajax result
     */
    @Log(title = "操作日志记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        iotOperLogService.deleteIotOperLogByIds(ids);
        return AjaxResult.success();
    }
}
